<?php

use think\migration\Migrator;
use think\migration\db\Column;

/**
 * Class Role 角色表
 */
class Role extends Migrator
{
    public function change()
    {
        $table = $this->table('role');
        $table->addColumn('title', 'string', ['limit'=>100, 'default'=>'', 'comment'=>'角色名称']);
        $table->addColumn('status', 'boolean', ['default'=>1, 'comment'=>'角色状态(0:禁用,1:开启)']);
        $table->addColumn('create_time', 'integer', ['default'=>0]);
        $table->addColumn('update_time', 'integer', ['default'=>0]);

        $table->insert([
            'id' => 1,
            'title' => '超级管理员',
            'status' => 1,
            'create_time' => time(),
        ]);
        $table->insert([
            'id' => 2,
            'title' => '普通管理员',
            'status' => 1,
            'create_time' => time(),
        ]);

        $table->save();
    }
}
